using System;
using System.Runtime;

public sealed class Program {
   static void Main() {
      try {
         // Logically reserve 1.5GB of memory
         using (MemoryFailPoint mfp = new MemoryFailPoint(1500)) {
            // Perform memory-hungry algorithm in here
         }
      }
      catch (InsufficientMemoryException e) {
         // The memory could not be reserved
         Console.WriteLine(e);
      }
   }
}
